﻿<?php
    $user = $_POST["username"];
    $psw = $_POST["password"];
    if($user=="" || $psw=="")
    {
        echo '<script>alert("请输入用户名或密码！");history.go(-1);</script>';	//分开写？
    }
    else
    {
        require("Include/conn.php");
        $sql = "SELECT `user_name`,`user_pwd` FROM `pw_user` WHERE `user_name`='$user' and `user_pwd`='$psw';";	//注意分号
        $result = mysqli_query($link,$sql);
        $num = mysqli_num_rows($result);
        if($num)
        {	//==1？
            //$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
            //echo "登陆成功！";
            echo '<script>window.location.href = "user.php";</script>';
        }
        else
        {
            echo '<script>alert("用户名或密码不正确！");history.go(-1);</script>';
        }
    }

?>